package com.ulife.order.api.response;

import com.ulife.common.gateway.utils.annotation.Description;

import java.util.ArrayList;
import java.util.List;

import java.io.Serializable;

/**
 * Created by Ulife- on 2015/12/30.
 */
@Description("订单状态信息")
public class OrderStatusInfo implements Serializable {

    @Description("订单编号")
    public String saleNo;
    @Description("订单状态")
    public int status;
    @Description("订单状态")
    public String statusValue;
    @Description("订单支付类型")
    public String payType;

    @Description("缺货商品列表")
    public List<OutStockItemInfo> outStockItemList;

    public String getSaleNo() {
        return saleNo;
    }

    public void setSaleNo(String saleNo) {
        this.saleNo = saleNo;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public String getPayType() {
        return payType;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public String getStatusValue() {
        return statusValue;
    }

    public void setStatusValue(String statusValue) {
        this.statusValue = statusValue;
    }

    public List<OutStockItemInfo> getOutStockItemList() {
        return outStockItemList;
    }

    public void setOutStockItemList(List<OutStockItemInfo> outStockItemList) {
        this.outStockItemList = outStockItemList;
    }

    /**
     *  添加一个缺货商品
     * @param itemId 缺货商品ItemId
     * @param skuName 商品名称
     * @param orderQty 商品订单数量
     * @param stockQty 商品库存数量
     */
    public void addOutStockItem(long itemId,String skuName,int orderQty,int stockQty){
        OutStockItemInfo outStockItem = new OutStockItemInfo();
        outStockItem.setItemId(itemId);
        outStockItem.setSkuName(skuName);
        outStockItem.setOrderQuantity(orderQty);
        outStockItem.setStockQuantity(stockQty);
        this.outStockItemList.add(outStockItem);
    }


    public OrderStatusInfo(){
        this.outStockItemList = new ArrayList<>();
    }

    @Description("缺货商品信息")
    public class OutStockItemInfo implements  Serializable{

        @Description("缺货商品itemId")
        public long itemId;

        @Description("缺货商品名称")
        public String skuName;

        @Description("购买数量")
        public int orderQuantity;

        @Description("库存数量")
        public int stockQuantity;

        public long getItemId() {
            return itemId;
        }

        public void setItemId(long itemId) {
            this.itemId = itemId;
        }

        public String getSkuName() {
            return skuName;
        }

        public void setSkuName(String skuName) {
            this.skuName = skuName;
        }

        public int getOrderQuantity() {
            return orderQuantity;
        }

        public void setOrderQuantity(int orderQuantity) {
            this.orderQuantity = orderQuantity;
        }

        public int getStockQuantity() {
            return stockQuantity;
        }

        public void setStockQuantity(int stockQuantity) {
            this.stockQuantity = stockQuantity;
        }
    }
}
